package manong.mapper;

import manong.beans.Teacher;
import manong.beans.TeacherQuery;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.session.RowBounds;

import java.util.List;
@Mapper
public interface TeacherMapper {
  
    long countByExample(TeacherQuery example);

    int deleteByExample(TeacherQuery example);

   
    @Delete({
        "delete from teacher",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

 
    @Insert({
        "insert into teacher (teacher_name, teacher_phone, ",
        "count_limit, statu, ",
        "mark)",
        "values (#{teacherName,jdbcType=VARCHAR}, #{teacherPhone,jdbcType=VARCHAR}, ",
        "#{countLimit,jdbcType=INTEGER}, #{statu,jdbcType=INTEGER}, ",
        "#{mark,jdbcType=VARCHAR})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Integer.class)
    int insert(Teacher record);

    int insertSelective(Teacher record);

    List<Teacher> selectByExampleWithRowbounds(TeacherQuery example, RowBounds rowBounds);

   
    Teacher selectOneByExample(TeacherQuery example);

    List<Teacher> selectByExample(TeacherQuery example);

   
    @Select({
        "select",
        "id, teacher_name, teacher_phone, count_limit, statu, mark",
        "from teacher",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("manong.mapper.TeacherMapper.BaseResultMap")
    Teacher selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") Teacher record, @Param("example") TeacherQuery example);

   
    int updateByExample(@Param("record") Teacher record, @Param("example") TeacherQuery example);

   
    int updateByPrimaryKeySelective(Teacher record);

   
    @Update({
        "update teacher",
        "set teacher_name = #{teacherName,jdbcType=VARCHAR},",
          "teacher_phone = #{teacherPhone,jdbcType=VARCHAR},",
          "count_limit = #{countLimit,jdbcType=INTEGER},",
          "statu = #{statu,jdbcType=INTEGER},",
          "mark = #{mark,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Teacher record);

   
    int insertOrUpdate(Teacher record);

   
    int insertOrUpdateSelective(Teacher record);

 
    int batchInsert(@Param("list") List<Teacher> list);

     int batchInsertSelective(@Param("list") List<Teacher> list, @Param("selective") Teacher.Column ... selective);
}